// all these tables are used in many functions as
// brute force process 
// canonical process (especially canonical on pattenrs)
// UAs search
#include "sk_typ0.h"
#include "sk_bf3.h"
extern int  String27(int f,int * r);
extern BF3 bf3boxes[9];
// general correspondance row column box band pattern 

extern int TblMult3[9];  // 3*i
extern int TblMult9[9];  // 9*i
extern byte Tblmod3[27];  // i%3
extern byte Tbldiv3[27]; //i/3

extern byte Tblofftorow[81];  // i/9 cell to row
extern byte TblMod9[81]; //  i%9 cell to column
extern byte Tbloffset[81]; // i%27  giving cell to offset in a band
extern byte TblBoard_Block[81]; //  i/27  giving cell -> band 
extern byte TblCelltoBox[81];  
extern CELL_U cell_u[81];  // cell to col / box units 0 - 27
extern int Tblofftobox[27] ; // cell in band to relative box in band

extern byte Tbltranspose_c[81];
extern byte Tbltranspose_d[81];
extern byte Tbltranspose_d2[81];
extern byte Tbltranspose_r[81];


// specific to the brute force zhou process

extern int TblOtherMask9[9] ; //((1<<i) * Zhoucol) ^ BIT_SET_30
extern int  Tblstartblock[27]; // (i%3) * 27 in zhou brute force
extern byte TblAnother1[27];// other bands for a F[i]
extern byte TblAnother2[27];
extern int TblBoard_BlockMask27[27]; //1<<i 
extern int TblRowMask[8];// rows where single  found  000 to 111
extern word TblShrinkUnsolved[8]; // only unsolved rows
extern int TblMask26row[9];
extern byte TblOtherSameBand[27][8]; // cleaning cells other digits
extern byte TblShrinkMask[512] ;// existing minirows 000 to 111
extern int TblComplexMask[512]; // keep mini rows still valid optimised process
extern int TblKillMask[512]; // killed candidates pointing general
extern word TblComplexShort[512];  // same as complex  minirows still valid
extern word TblComplexShortBox[512];
extern word TblNewBoxRow[512]; // new minirow alone in box after shrink
extern byte TblRowUniq[512] ; // 1 is row not defined in block  mode  to 111
extern word TblColumnSingleinBox[512];
extern word TblColumnSingle[512]; // single in column applied to shrinked bloc
extern word TblShrinkSingle[512] ; // keep only rows with single
extern int TblMaskSingle[512]; // kill in other blocks locked column /box
extern int TblMaskDouble[512];// kill for locked in box / column

// general bit maps tables

extern byte BitCount[512] ; 	// number of bits (1)  in a 9 bits field
extern byte TblBitToInd[512] ; 
extern byte TblBitIndex[257] ; // directly index 0_8
extern byte Tblfirst0_8[512] ;


//int TblUniqFlag[8] = {1,1,1,0,1,0,0,0};

extern byte tv_string[1024];
extern word tv_strindex[256];

extern char *  empty_puzzle;
extern char * puzstart;

extern byte cellsInGroup[27][9];
extern byte miniline[54][3]; 
extern byte box_miniline[54][3]; 
extern byte tperm6[6][3];
extern int tperm3[3][3];
extern byte tmax3[8]; // minirow max pattern 
extern byte tmin3[8]; // minirow min pattern
extern word maxminirow[512];
extern word box_col_to_row[512];// transpose a box
extern word tmax9[512]; // computed table max equivalent to a pattern for row1
extern word tmin9[512]; // computed table to switch to minilex (in a box for magic40)
extern byte with_hole[512];
extern word trowperms[512][1296]; // table of all row possible perms
extern byte tcrossperms[64][72]; //  perms 2 minirows minlex 
extern byte tpermsminir1[8][6];  // perms to order box1 on minlex cross 
extern byte tpermorder[1296][9];
extern byte tp_3_6_3_3[162][9]; //used in UA 4;6 search

extern byte tmax9order[512][9]; //same, giving the permutation used 

// minlex starts and gangsters
extern char * t16[416];
extern char * t44gang[44];
extern byte t416to44[416];
// magic 50
extern word tmagicbox1[12];
extern word tmagic40[50][5];
extern byte patnumber[50];
extern byte boxes_5 [9][5];
extern int tpat40_sort[50][3];

